#include <vector>
#include <iostream>

using namespace std;

class Solution {
public:
    int minSubArrayLen(int s, vector<int>& nums) {
        int left = 0;
        int right = 0;
        int sum = 0;
        int len = INT32_MAX;
        for (int val : nums) {
            sum += val;
            while (sum >= s) {
                sum -= nums[left];
                len = min(len, right - left + 1);
                left++;
            }
            right++;
        }
        return len == INT32_MAX ? 0 : len;
    }
};

int main() {
    vector<int> input = {2, 3, 1, 2, 4, 3};
    Solution solution;
    int output = solution.minSubArrayLen(7, input);
    cout << output << endl;
    return 0;
}